import { snake } from "./snake";
import { underscore } from "./underscore";

/**
 * Convert a string C/C++ constant-style.
 *
 * example:
 * ```
 * NAME_STYLES_IS_A_GOOD_LIBRARY
 * __NAME_STYLES___IS_A_GOOD_LIBRARY
 * ```
 *
 * @param {string} s source string
 * @param {boolean} isKeepSpecial predicate if keep leading and continues underlines.
 * @return {string} converted result with C/C++ constant style string.
 */
export function constant(s: string, isKeepSpecial: boolean = false): string {
    const convert = isKeepSpecial ? underscore : snake;
    return convert(s).toUpperCase();
}
